import axios from "axios"
export default {
    async modifyUser(user) {
        await axios.put("/api/user/" + user._id, user)
    },
    async getUserById(id) {
        const res = await axios.get("/api/user/" + id)
        return res.data
    },
    async whoami() {
        const res = await axios.get("/api/user/whoami")
        return res.data
    },
    async login(u) {
        const res = await axios.post("/api/user/login", u)
        return res.data
    },
    async zhuce(u) {
        const res = await axios.post("/api/user/add", u)
        return res.data
    },
    async getUserAll(query = {}) {
        const res = await axios.get("/api/user/all", {
            params: query
        })
        return res.data
    },
    async deleteUser(id) {
        await axios.delete("/api/user/" + id)
    }
}